package listbyorder.access201_300.test287;

import java.util.Arrays;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/28 13:58
 */
public class Solution1 {

    public int findDuplicate(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i < nums.length - 1; i++) {
            if (nums[i] == nums[i + 1]) {
                return nums[i];
            }
        }
        return -1;
    }
}
